import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class TheThirdTask {

	private final String URI = "http://karaf.apache.org/index/community/mailing-lists.html";
	private final String INPUT = "([_\\w\\d-]+)(\\.[_\\w\\d-]+)*@[\\w\\d-]+(\\.[\\w\\d-]+)*(\\.[\\w\\d]{2,})";
	
	public static void main(String[] args) {
		TheThirdTask third = new TheThirdTask();
		try {
			third.getHTML();
		} catch (Exception e) {
			e.printStackTrace();
		}		
	}
	
	private void getHTML() throws Exception {
		URL url = new URL(URI);
		BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));
		
		
		String line;
        while ((line = in.readLine()) != null)
        	parseEMail(line);
        in.close();
	}
	
	private void parseEMail(String line) {
		Pattern p = Pattern.compile(INPUT);
		
		Matcher m = p.matcher(line);
		
		while (m.find()) {
			System.out.println(m.group());
		}
	}
}
